home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number6 / iconview.kb < prev    next >
Text File  |  1990-12-17  |  2KB  |  60 lines

  1. (* An Icon Viewer Example Program*)
  2. (*Eric Anderson*)
  3. (* ⌐ 1990 Moon Valley Software Inc.*)
  4.  
  5. (*Define the main Application Window*)
  6.  w1 is window(,18,10,30,12,'Icon Viewer',
  7.                    [Popup,Visible,MinimizeBox,
  8.                    showchildren,ControlMenu,
  9.                    TitleBar,ThickFrame]).
  10.  
  11. menu([&View,&About,E&xit], GetOption).   (*The App Menu*)
  12.  
  13. icn is load_icon('KPWIN.ICO'). (*Load an icon for the App.*)
  14.  
  15. attach_icon(?w1,?icn).         (*Attach the icon to the App.*)
  16.  
  17.  
  18.  topic GetOption(menu_item).   (*Create The Menu*)
  19.        do (?menu_item).
  20.     
  21.  topic &View.                  (*Choose an icon display*)
  22.                                (*Display the list box*)
  23.       list_box(dir ('*.ico'), select, 2, 2,,,,, [list_select_event]).
  24.  
  25.  end.
  26.  
  27.   topic select (item, event ). (*Display the selected icon*)
  28.     item is load_icon(?item).  (*If there is an event load the icon*)
  29.     icon(?item,20,2).          (*Display the icon*)
  30.   end.
  31.  
  32.   topic &About.                (*The About Box*)
  33.      w2 is window(,26.42,6,41.14,13,'About Icon Viewer',
  34.                                     [DialogWindow,Visible,TitleBar]).
  35.   text ('
  36.                          Icon Viewer
  37.  
  38.                Knowledge Pro for Windows
  39.                      Example Program
  40.  
  41.                     ⌐ Copyright 1990
  42.                Moon Valley Software Inc.
  43.  
  44.  ').
  45.  
  46.   (*The OK button in the about box: *)
  47.   b1 is button ('&OK',Done,14.71,9.875,12).
  48.   set_focus(?b1).                   (*Set the input focus*)
  49.  
  50.     topic Done.                     (*Close the About Box*)
  51.       close_window(?w2).
  52.     end.
  53.  
  54.   end.  (* &About *)
  55.  
  56.   topic E&xit.                      (*Close the program*)
  57.     clear ().  (* Closes all windows, frees all memory, etc. *)
  58.   end.
  59.  
  60.  end.  (*GetOption*)